/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.universityUnits;

import model.entitys.Entity;
import model.staff.Student;

/**
 * Class Course represents model of academic course - set of academical groups.
 * Course has its headman, its number and groups.
 * @author Dmitri Paziy
 */
class Course extends Entity<Group> {
    private Student headman;
    private int course;

    public Course() {
        course = 1;
    }

    /**
     * Getter of headman of the course, may return <i>null</i>, if headman wasn't
     * set, or previous value was <i>null</i>.
     * @return current headman
     */
    public Student getHeadman() {
        return headman;
    }

    /**
     * Setter of headman of the course. Doesn't test on <i>null</i> value.
     * @param headman student, that will be new headman
     */
    public void setHeadman(Student headman) {
        this.headman = headman;
    }
    
    /**
     * Getter of course number. If course number wasn't set, default value
     * is 1.
     * @return 
     */
    public int getCourse() {
        return course;
    }

    /**
     * Setter of course number
     * @param course Course number
     */
    public void setCourse(int course) {
        this.course = course;
    }
    
    /**
     * Counts the amount of students on the course
     * If there is no students, amount will be 0.
     * @return Amount of students
     */
    public int getStudentsAmount() {
        int amount = 0;
        
        for (int index = 0; index < size(); index++) {
            amount += get(index).size();
        }
        
        return amount;
    }
}
